// 非遗活动模型
class HeritageActivity {
  final String id;
  final String title;
  final String description;
  final String imageUrl;
  final DateTime startDate;
  final DateTime endDate;
  final String location;
  final String category;
  final List<String> tags;
  final int maxParticipants;
  final int currentParticipants;
  final double price;
  final String organizer;
  final String contactInfo;
  final ActivityStatus status;
  final String requirements;
  final List<String> highlights;
  final double rating;
  final int reviewCount;
  final bool isFeatured;
  final bool isRecommended;
  final DateTime createdAt;
  final DateTime updatedAt;

  const HeritageActivity({
    required this.id,
    required this.title,
    required this.description,
    required this.imageUrl,
    required this.startDate,
    required this.endDate,
    required this.location,
    required this.category,
    required this.tags,
    required this.maxParticipants,
    required this.currentParticipants,
    required this.price,
    required this.organizer,
    required this.contactInfo,
    required this.status,
    required this.requirements,
    required this.highlights,
    required this.rating,
    required this.reviewCount,
    required this.isFeatured,
    required this.isRecommended,
    required this.createdAt,
    required this.updatedAt,
  });

  HeritageActivity copyWith({
    String? id,
    String? title,
    String? description,
    String? imageUrl,
    DateTime? startDate,
    DateTime? endDate,
    String? location,
    String? category,
    List<String>? tags,
    int? maxParticipants,
    int? currentParticipants,
    double? price,
    String? organizer,
    String? contactInfo,
    ActivityStatus? status,
    String? requirements,
    List<String>? highlights,
    double? rating,
    int? reviewCount,
    bool? isFeatured,
    bool? isRecommended,
    DateTime? createdAt,
    DateTime? updatedAt,
  }) {
    return HeritageActivity(
      id: id ?? this.id,
      title: title ?? this.title,
      description: description ?? this.description,
      imageUrl: imageUrl ?? this.imageUrl,
      startDate: startDate ?? this.startDate,
      endDate: endDate ?? this.endDate,
      location: location ?? this.location,
      category: category ?? this.category,
      tags: tags ?? this.tags,
      maxParticipants: maxParticipants ?? this.maxParticipants,
      currentParticipants: currentParticipants ?? this.currentParticipants,
      price: price ?? this.price,
      organizer: organizer ?? this.organizer,
      contactInfo: contactInfo ?? this.contactInfo,
      status: status ?? this.status,
      requirements: requirements ?? this.requirements,
      highlights: highlights ?? this.highlights,
      rating: rating ?? this.rating,
      reviewCount: reviewCount ?? this.reviewCount,
      isFeatured: isFeatured ?? this.isFeatured,
      isRecommended: isRecommended ?? this.isRecommended,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
    );
  }

  bool get isAvailable => currentParticipants < maxParticipants;
  bool get isUpcoming => DateTime.now().isBefore(startDate);
  bool get isOngoing => DateTime.now().isAfter(startDate) && DateTime.now().isBefore(endDate);
  bool get isCompleted => DateTime.now().isAfter(endDate);
  
  String get statusText {
    switch (status) {
      case ActivityStatus.upcoming:
        return '即将开始';
      case ActivityStatus.ongoing:
        return '进行中';
      case ActivityStatus.completed:
        return '已结束';
      case ActivityStatus.cancelled:
        return '已取消';
      case ActivityStatus.full:
        return '已满员';
      case ActivityStatus.suspended:
        return '已暂停';
    }
  }
}

enum ActivityStatus {
  upcoming,
  ongoing,
  completed,
  cancelled,
  full,
  suspended,
}

enum ActivityCategory {
  workshop,
  lecture,
  performance,
  exhibition,
  competition,
  festival,
}